home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Turnbull China Bikeride
/
Turnbull China Bikeride - Disc 1.iso
/
ARGONET
/
PD
/
MATHS
/
RLAB
/
RLAB125.ZIP
/
!RLaB
/
help_jr
/
rand
< prev
next >
Wrap
Text File
|
1994-08-31
|
3KB
|
124 lines
rand:
Syntax: rand ( )
rand ( nrow , ncol )
rand ( "type" )
rand ( "type" , d1 )
rand ( "type" , d1 , d2 )
Description:
rand() creates a random scalar, or matrix.
`rand()' produces a random scalar.
`rand ( X , Y )' produces a randomly generated MATRIX with row
dimension X, and column dimension Y.
`rand ( "type" , ... )' changes the distribution used when
generating random numbers. The value of type determines the
subsequent parameters.
type:
rand( "beta" , A , B )
Sets the generator to return a random deviate from the
beta distribution with parameters A and B. The density of
the beta is
x^(a-1) * (1-x)^(b-1) / B(a,b) for 0 < x < 1
rand ( "chi" , DF )
Sets the generator to return a random deviate from the
distribution of a chi-square with DF degrees of freedom random
variable.
rand ( "exp" , AV )
Sets the generator to return a random deviate from an
exponential distribution with mean AV.
rand ( "f" , DFN DFD )
Sets the generator to return a random deviate from the F
(variance ratio) distribution with DFN degrees of freedom in
the numerator and DFD degrees of freedom in the denominator.
rand ( "gamma" , A , R )
Sets the generator to return a random deviate from the gamma
distribution whose density is:
(A**R)/Gamma(R) * X**(R-1) * Exp(-A*X)
rand ( "nchi" , DF , XNONC )
Sets the generator to return a random deviate from the
distribution of a noncentral chi-square with DF degrees of
freedom and noncentrality parameter XNONC.
rand ( "nf" , DFN , DFD, XNONC )
Sets the generator to return a random deviate from the
noncentral F (variance ratio) distribution with DFN degrees of
freedom in the numerator, and DFD degrees of freedom in the
denominator, and noncentrality parameter XNONC.
rand ( "normal" , AV , SD )
Sets the generator to return a random deviate from a normal
distribution with mean, AV, and standard deviation, SD.
rand ( "uniform" , LOW , HIGH )
Sets the generator to return a uniform double between LOW and
HIGH
rand ( "bin" , N , P )
Returns a single random deviate from a binomial distribution
whose number of trials is N and whose probability of an event
in each trial is P.
rand ( "poisson" , AV )
Sets the generator to return a random deviate from a
Poisson distribution with mean AV.
rand ( "default" )
Resets the random number generator to the default generator,
which generates a distributed random variable in the interval
0 -> 1. The interval endpoints are not returned.
Examples:
> rand()
0.368
> rand(4)
vector elements 1 thru 4
0.983 0.535 0.766 0.646
> rand(3,3)
matrix columns 1 thru 3
0.767 0.152 0.347
0.78 0.625 0.917
0.823 0.315 0.52
> rand("norm", 10.0, 2.0 );
> rand(10)
vector elements 1 thru 5
9.86 11.8 12.1 7.35 8.76
vector elements 6 thru 10
10.5 7.44 11.1 6.93 9.87
rand() uses the RANLIB library, authored by B. W. Brown and
J. Lovato under grant CA-16672 from the National Cancer
Institute.
See Also: srand